#include "mainwindow.h"
#include "ui_mainwindow.h"

#include <QDebug>

#include "ffmpegs.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_audioButton_clicked() {

    AudioEncodeSpec out;
    out.filename = "/Users/os/Desktop/FFmpegProject/aacDecoder/out.pcm";

    FFmpegs::aacDecode(out, "/Users/os/Desktop/FFmpegProject/aacDecoder/in.aac");

    // 44100
    qDebug() << out.sampleRate;
    // s16
    qDebug() << av_get_sample_fmt_name(out.sampleFmt);
    // 2
    qDebug() << av_get_channel_layout_nb_channels(out.chLayout);

//    if (!_audioThread) {
//        _audioThread = new AudioThread(this);
//        _audioThread->start();
//    } else {
//        _audioThread->requestInterruption();
//        _audioThread = nullptr;
//    }
}
